<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <router-view></router-view>

    <script>
        import { createRouter, createWebHashHistory } from 'vue-router'

        const routes = [
            {
                path: '/',
                props: {},
                // 除了首页的内容。其他路由可以分模块带包到js文件中，可不必每个path都对应一个js，减少http请求
                // component: () => import(/* webpackChunkName:"login" */'../login.vue')   // 打包出来的js文件叫login
                // component: () => import(/* webpackChunkName:"goods" */'../goods.vue')
                // component: () => import(/* webpackChunkName:"goods" */'../goodsdetail.vue') // 两个vue文件打包到goods.js文件里
                component: () => import('../index.vue')
            },
            {
                // path: '*', 不能用*
                path: "/:pathMatch(.*)*/",
                redirct: '/'
            }
        ];

        const router = createRouter({
            history: createWebHashHistory(),
            routes
        })
    </script>

    <script setup>
        import { useRoute, useRouter } from 'vue-router'
        const route = useRoute()
        const router1 = useRouter()
    </script>
</body>
</html>